package model;

import junit.framework.TestCase;

public class KundeTest extends TestCase{

	private static Kunde instance; 

	private static Name name;
	private static Adresse adresse;
	private static Datum geburtsDatum;
	
	private static final String telefonnr = "0211631654643618435";
	private static final int kundennr = 1234567;
	private static final double bonus = 55.12;
	
	private static final String anrede = "Sir";
	private static final String vorname = "Kloß";
	private static final String nachname = "Müsterman";
	
	private static final String strasse = "Strasse";
	private static final String hausnr = "345a";
	private static final String plz = "76413";
	private static final String ort = "NeStadt";
	
	private static final int jahr = 1966;
	private static final int monat = 4;
	private static final int tag = 25;
	
	
	
	@Override
	protected void setUp() throws Exception {
		super.setUp();
		
		name = new Name(anrede,vorname,nachname);
		adresse = new Adresse(strasse, hausnr, plz, ort);
		geburtsDatum = new Datum(jahr, monat, tag);
		
		instance = new Kunde(name, adresse, telefonnr, geburtsDatum, kundennr, bonus);
	}
	
/*
 * tests for constructors
 */
	public void testConstructor() {
		Kunde kunde = new Kunde(name, adresse, telefonnr, geburtsDatum, kundennr, bonus);
		
		assertEquals(name, kunde.getName());
		assertEquals(adresse, kunde.getAdresse());
		assertEquals(telefonnr, kunde.getTelefonnr());
		assertEquals(geburtsDatum, kunde.getGeburtsdatum());
		assertEquals(kundennr, kunde.getKundennr());
		assertEquals(bonus, kunde.getBonus());
	}

	public void testistVolljaehrig(){
		
		assertEquals(true, instance.istVolljaehrig());
		
		instance.setGeburtsdatum(new Datum());
		
		assertEquals(false, instance.istVolljaehrig());
		
		instance.setGeburtsdatum(geburtsDatum);
	}
}
